package org.nepu.srr.设备设施资料.探测及报警系统证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B49DetectiveParams {
    @ApiModelProperty("火警报警装置")
    CommonIn fireAlarmSystem;

    @ApiModelProperty("感温式探头")
    CommonIn temperatureAlarmSystem;

    @ApiModelProperty("感烟式探头")
    CommonIn smokeAlarmSystem;

    @ApiModelProperty("感光式探头")
    CommonIn infraredAlarmSystem;

    @ApiModelProperty("可燃气体报警装置")
    CommonIn flammableGasAlarmSystem;

    @ApiModelProperty("可燃气体探头")
    CommonIn flammableGasDetector;

    @ApiModelProperty("硫化氢探头")
    CommonIn sulfurDioxideDetector;

    @ApiModelProperty("状态灯")
    CommonIn statusLight;

    @ApiModelProperty("硫化氢报警装置")
    CommonIn sulfurDioxideAlarmSystem;

    @ApiModelProperty("手动报警测试")
    CommonIn manualAlarmTest;

    @ApiModelProperty("便携式气体探测器")
    CommonIn portableGasDetector;

    public B49DetectiveResult rate(){
        double fullScore = 110;
        double score = 0;
        if(CommonMethods.isAllTrue(fireAlarmSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(temperatureAlarmSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(smokeAlarmSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(infraredAlarmSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(flammableGasAlarmSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(flammableGasDetector.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(sulfurDioxideDetector.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(statusLight.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(sulfurDioxideAlarmSystem.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(manualAlarmTest.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(portableGasDetector.getInput())){
            score += 10;
        }
        double rate = score / fullScore;
        B49DetectiveResult result = new B49DetectiveResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;
    }
}
